<!--
 * @Author: your name
 * @Date: 2020-12-28 16:30:53
 * @LastEditTime: 2020-12-28 16:41:41
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \basiccss\box\fit-content.html
-->
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>fit-content</title>
    <style>
        *{
            padding: 0;
            margin: 0;
        }
        body{
            width: 100vw;
            height: 100vh;
            background: #9b59b6;
        }
        /*
            fit-content  根据内容自适应宽度
        */
        h2{
            text-align: center;
            background: #2ecc71;
            width: fit-content;
            margin: auto;
        }
    </style>
</head>
<body>
    <h2>houdunren.com111111111111</h2>
</body>
</html>